﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;


namespace FAP.DataAccess.BLL
{
    public class chitietbuocthuchien
    {
        public int id { get; set; }
        public string tenfield { get; set; }
        public string kieudulieu { get; set; }
        public int fieldformatid { get; set; }
        public string dulieumacdinh { get; set; }
        public int idbuocthuchien { get; set; }
        public bool isdeleted { get; set; }
        //public fieldformat fieldformat { get { return fieldformat.fieldformatSelectRow(fieldformatid); } }
        //public buocthuchien buocthuchien { get { return buocthuchien.buocthuchienSelectRow(idbuocthuchien); } }

        #region chitietbuocthuchienSelectAll
        public static List<chitietbuocthuchien> chitietbuocthuchienSelectAll()
        {
            IDataReader dr = FAP.DataAccess.DAL.chitietbuocthuchienSelectAll();
            List<chitietbuocthuchien> chitietbuocthuchienList = new List<chitietbuocthuchien>();
            while (dr.Read())
            {
                chitietbuocthuchien mychitietbuocthuchien = new chitietbuocthuchien
                {
                    id = !dr.IsDBNull(dr.GetOrdinal("id")) ? (int)dr["id"] : 0,
                    tenfield = !dr.IsDBNull(dr.GetOrdinal("tenfield")) ? (string)dr["tenfield"] : null,
                    kieudulieu = !dr.IsDBNull(dr.GetOrdinal("kieudulieu")) ? (string)dr["kieudulieu"] : null,
                    fieldformatid = !dr.IsDBNull(dr.GetOrdinal("fieldformatid")) ? (int)dr["fieldformatid"] : 0,
                    dulieumacdinh = !dr.IsDBNull(dr.GetOrdinal("dulieumacdinh")) ? (string)dr["dulieumacdinh"] : null,
                    idbuocthuchien = !dr.IsDBNull(dr.GetOrdinal("idbuocthuchien")) ? (int)dr["idbuocthuchien"] : 0,
                    isdeleted = !dr.IsDBNull(dr.GetOrdinal("isdeleted")) ? (bool)dr["isdeleted"] : false
                };
                chitietbuocthuchienList.Add(mychitietbuocthuchien);
            }
            dr.Close();
            dr.Dispose();
            return chitietbuocthuchienList;
        }
        #endregion

        #region chitietbuocthuchienSelectRow
        public static chitietbuocthuchien chitietbuocthuchienSelectRow(int id)
        {
            IDataReader dr = FAP.DataAccess.DAL.chitietbuocthuchienSelectRow(id);
            chitietbuocthuchien chitietbuocthuchien = null;

            if (dr.Read())
            {
                chitietbuocthuchien = new chitietbuocthuchien
                {
                    id = !dr.IsDBNull(dr.GetOrdinal("id")) ? (int)dr["id"] : 0,
                    tenfield = !dr.IsDBNull(dr.GetOrdinal("tenfield")) ? (string)dr["tenfield"] : null,
                    kieudulieu = !dr.IsDBNull(dr.GetOrdinal("kieudulieu")) ? (string)dr["kieudulieu"] : null,
                    fieldformatid = !dr.IsDBNull(dr.GetOrdinal("fieldformatid")) ? (int)dr["fieldformatid"] : 0,
                    dulieumacdinh = !dr.IsDBNull(dr.GetOrdinal("dulieumacdinh")) ? (string)dr["dulieumacdinh"] : null,
                    idbuocthuchien = !dr.IsDBNull(dr.GetOrdinal("idbuocthuchien")) ? (int)dr["idbuocthuchien"] : 0,
                    isdeleted = !dr.IsDBNull(dr.GetOrdinal("isdeleted")) ? (bool)dr["isdeleted"] : false,

                };
            }
            dr.Close();
            dr.Dispose();
            return chitietbuocthuchien;
        }
        #endregion

        #region chitietbuocthuchienSelectRowByForeignKey_fieldformatid
        public static List<chitietbuocthuchien> chitietbuocthuchienSelectRowByForeignKey_fieldformatid(int fieldformatid)
        {
            IDataReader dr = FAP.DataAccess.DAL.chitietbuocthuchienSelectRowByForeignKey_fieldformatid(fieldformatid);
            List<chitietbuocthuchien> chitietbuocthuchienList = new List<chitietbuocthuchien>();
            while (dr.Read())
            {
                chitietbuocthuchien mychitietbuocthuchien = new chitietbuocthuchien
                {
                    id = !dr.IsDBNull(dr.GetOrdinal("id")) ? (int)dr["id"] : 0,
                    tenfield = !dr.IsDBNull(dr.GetOrdinal("tenfield")) ? (string)dr["tenfield"] : null,
                    kieudulieu = !dr.IsDBNull(dr.GetOrdinal("kieudulieu")) ? (string)dr["kieudulieu"] : null,
                    fieldformatid = !dr.IsDBNull(dr.GetOrdinal("fieldformatid")) ? (int)dr["fieldformatid"] : 0,
                    dulieumacdinh = !dr.IsDBNull(dr.GetOrdinal("dulieumacdinh")) ? (string)dr["dulieumacdinh"] : null,
                    idbuocthuchien = !dr.IsDBNull(dr.GetOrdinal("idbuocthuchien")) ? (int)dr["idbuocthuchien"] : 0,
                    isdeleted = !dr.IsDBNull(dr.GetOrdinal("isdeleted")) ? (bool)dr["isdeleted"] : false
                };
                chitietbuocthuchienList.Add(mychitietbuocthuchien);
            }
            dr.Close();
            dr.Dispose();
            return chitietbuocthuchienList;
        }
        #endregion

        #region chitietbuocthuchienSelectRowByForeignKey_idbuocthuchien
        public static List<chitietbuocthuchien> chitietbuocthuchienSelectRowByForeignKey_idbuocthuchien(int idbuocthuchien)
        {
            IDataReader dr = FAP.DataAccess.DAL.chitietbuocthuchienSelectRowByForeignKey_idbuocthuchien(idbuocthuchien);
            List<chitietbuocthuchien> chitietbuocthuchienList = new List<chitietbuocthuchien>();
            while (dr.Read())
            {
                chitietbuocthuchien mychitietbuocthuchien = new chitietbuocthuchien
                {
                    id = !dr.IsDBNull(dr.GetOrdinal("id")) ? (int)dr["id"] : 0,
                    tenfield = !dr.IsDBNull(dr.GetOrdinal("tenfield")) ? (string)dr["tenfield"] : null,
                    kieudulieu = !dr.IsDBNull(dr.GetOrdinal("kieudulieu")) ? (string)dr["kieudulieu"] : null,
                    fieldformatid = !dr.IsDBNull(dr.GetOrdinal("fieldformatid")) ? (int)dr["fieldformatid"] : 0,
                    dulieumacdinh = !dr.IsDBNull(dr.GetOrdinal("dulieumacdinh")) ? (string)dr["dulieumacdinh"] : null,
                    idbuocthuchien = !dr.IsDBNull(dr.GetOrdinal("idbuocthuchien")) ? (int)dr["idbuocthuchien"] : 0,
                    isdeleted = !dr.IsDBNull(dr.GetOrdinal("isdeleted")) ? (bool)dr["isdeleted"] : false
                };
                chitietbuocthuchienList.Add(mychitietbuocthuchien);
            }
            dr.Close();
            dr.Dispose();
            return chitietbuocthuchienList;
        }
        #endregion

        #region chitietbuocthuchienInsertRow
        public static void chitietbuocthuchienInsertRow(string tenfield, string kieudulieu, int fieldformatid, string dulieumacdinh, int idbuocthuchien, bool isdeleted)
        {
            FAP.DataAccess.DAL.chitietbuocthuchienInsertRow(tenfield, kieudulieu, fieldformatid, dulieumacdinh, idbuocthuchien, isdeleted);
        }
        #endregion

        #region chitietbuocthuchienUpdateRow
        public static void chitietbuocthuchienUpdateRow(int id, string tenfield, string kieudulieu, int fieldformatid, string dulieumacdinh, int idbuocthuchien, bool isdeleted)
        {
            FAP.DataAccess.DAL.chitietbuocthuchienUpdateRow(id, tenfield, kieudulieu, fieldformatid, dulieumacdinh, idbuocthuchien, isdeleted);
        }
        #endregion

        #region chitietbuocthuchienDeleteRow
        public static void chitietbuocthuchienDeleteRow(int id)
        {
            FAP.DataAccess.DAL.chitietbuocthuchienDeleteRow(id);
        }
        #endregion
    }
}